home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 121 / af121sub.adf / WebVision.lzx / WebVision / Install WebVision < prev    next >
Text File  |  1999-01-07  |  8KB  |  347 lines

  1. ; $VER: Install WebVision 2.0 (15.12.98)
  2. ;
  3. ; WebVision webcam viewer, by Troels Walsted Hansen <troels@stud.cs.uit.no>
  4. ; Copyright Ultima Thule Software © 1998, All Rights Reserved.
  5. ;
  6. ; Installer script for WebVision.
  7.  
  8. (set #exitmsg "\n\nThank you for installing WebVision.\n\nRemember to register if you use it for more than 30 days.")
  9.  
  10. ; Welcome screen
  11.  
  12. (welcome "\nThis installer script will install WebVision.\nThe ultimate webcam viewer")
  13.  
  14. ; Check the environment
  15.  
  16. (if (< (/ @installer-version 65536) 43)
  17.     (abort "The WebVision installation script needs Installer\n"
  18.     "version 43 or higher. It is available from Aminet.")
  19. )
  20.  
  21. (if (< (/ (getversion) 65536) 39)
  22.     (abort "WebVision needs AmigaOS 3.0 or higher.\n")
  23. )
  24.  
  25. (if
  26.     (not (= (exists "MUI:" (noreq)) 2))
  27.     (abort "WebVision needs MUI 3.8 or higher.\n")
  28. )
  29.  
  30. ; Some smartass previous installation detection
  31.  
  32. (procedure p_tackoff string1 string2
  33.     (set #p_tackoff_result string1)
  34.  
  35.     (if
  36.         (>= (strlen string1) (strlen string2))
  37.  
  38.         (
  39.             (set #p_tackoff_diff (- (strlen string1) (strlen string2)))
  40.  
  41.             (if
  42.                 (= string2 (substr string1 #p_tackoff_diff (strlen string2)))
  43.  
  44.                 (set #p_tackoff_result (substr string1 0 #p_tackoff_diff))
  45.             )
  46.         )
  47.     )
  48.  
  49.     (#p_tackoff_result)
  50. )
  51.  
  52. (set #oldpath (getenv "WebVision_LASTUSEDDIR"))
  53.  
  54. (if
  55.     #oldpath
  56.  
  57.     (set @default-dest (p_tackoff #oldpath "WebVision"))
  58.  
  59.     (
  60.         (set #oldpath (getenv "WebTV_LASTUSEDDIR"))
  61.  
  62.         (if #oldpath
  63.             (set @default-dest (p_tackoff #oldpath "WebTV"))
  64.         )
  65.     )
  66. )
  67.  
  68. ; Ask for destination directory
  69.  
  70. (set #destdir
  71.     (askdir
  72.         (prompt "Select destination directory. A directory called \"WebVision\" will be created here.")
  73.         (help @askdir-help)
  74.         (default @default-dest)
  75.     )
  76. )
  77. (set @default-dest (tackon #destdir "WebVision"))
  78.  
  79. ; RobR detection
  80.  
  81. (if
  82.     (= (expandpath "") (expandpath @default-dest))
  83.     (abort "Please select a different directory than the one you're installing from.\n")
  84. )
  85.  
  86. ; Create installation directory and copy icon for it
  87.  
  88. (makedir @default-dest)
  89.  
  90. (copyfiles
  91.     (source "/WebVision.info")
  92.     (dest #destdir)
  93. )
  94.  
  95. ; Copy files
  96.  
  97. (copyfiles
  98.     (prompt "The following files will be installed:")
  99.     (help @copyfiles-help)
  100.     (source "")
  101.     (choices "WebVision" "WebVision.guide" "Registration" "Register" "DockBrushes")
  102.     (dest @default-dest)
  103.     (confirm)
  104.     (infos)
  105. )
  106.  
  107. ; Install OpenURL
  108.  
  109. (if 
  110.     (askbool
  111.         (prompt "Would you like to install the OpenURL package?\n\nOpenURL is a shared library that allows easy  sending of URLs to webbrowsers. The library is used extensively in WebVision, and is also supported by such programs as AmIRC and YAM.\n\nWithout it, you can only send URLs to the clipboard.\n\n")
  112.         (help "It is quite harmless to install this. You will get three new files, a library called openurl.library, a prefs program and a MUI class called Popport.mcc which is used by the prefs program.")
  113.         (choices "Install" "Don't install")
  114.         (default 1)
  115.     )
  116.  
  117.     (
  118.         (copylib
  119.             (prompt "Installing the OpenURL library")
  120.             (help @copyfiles-help)
  121.             (source "OpenURL/openurl.library")
  122.             (dest "Libs:")
  123.         )
  124.         
  125.         (copyfiles
  126.             (prompt "Installing the OpenURL preference program")
  127.             (help @copyfiles-help)
  128.             (source "OpenURL/OpenURL")
  129.             (dest "SYS:Prefs")
  130.             (infos)
  131.             (noposition)
  132.         )
  133.         
  134.         (copylib
  135.             (prompt "Installing the Popport.mcc MUI class")
  136.             (help @copyfiles-help)
  137.             (source "OpenURL/Popport.mcc")
  138.             (dest "MUI:Libs/MUI")
  139.         )
  140.  
  141.         (if
  142.             (askbool
  143.                 (prompt "You should run the OpenURL preferences program now to set your browser path(s). Would you like me to launch it?")
  144.                 (help "")
  145.                 (default 1)
  146.             )
  147.  
  148.             (run "SYS:Prefs/OpenURL")
  149.         )
  150.     )
  151. )
  152.  
  153. ; Check for prior installations
  154.  
  155. (set #webtvpath (getenv "WebTV_LASTUSEDDIR"))
  156.  
  157. (if #webtvpath
  158.     (set #webtvinstalled
  159.         (and
  160.             (= (exists (tackon #webtvpath "WebTV"))     1)
  161.             (= (exists (tackon #webtvpath "WebVision")) 0)
  162.         )
  163.     )
  164.  
  165.     (set #webtvinstalled 0)
  166. )
  167.  
  168. ; Copy old files over from old WebTV installation
  169.  
  170. (if
  171.     #webtvinstalled
  172.  
  173.     (set
  174.         #copyoldfiles
  175.         (askbool
  176.             (prompt "An installation of WebTV has been detected. Would you like to copy over the keyfile (if you have one), the site configuration file and the MUI configuration file from this installation?")
  177.             (help "The following operations are performed:\nCopy WebTV.key TO WebVision.key\nCopy WebTV.sites TO WebVision.sites\nCopy ENV:mui/WEBTV.1.prefs TO ENV:mui/WEBVISION.1.prefs\nCopy ENVARC:mui/WEBTV.1.prefs TO ENVARC:mui/WEBVISION.1.prefs")
  178.             (default 1)
  179.         )
  180.     )
  181.  
  182.     (set #copyoldfiles 0)
  183. )
  184.  
  185. (if
  186.     #copyoldfiles
  187.  
  188.     (
  189.         (copyfiles
  190.             (source (tackon #webtvpath "WebTV.sites"))
  191.             (dest @default-dest)
  192.             (newname "WebVision.sites")
  193.             (optional "nofail")
  194.         )
  195.  
  196.         (copyfiles
  197.             (source (tackon #webtvpath "WebTV.key"))
  198.             (dest @default-dest)
  199.             (newname "WebVision.key")
  200.             (optional "nofail")
  201.         )
  202.  
  203.         (copyfiles
  204.             (source "ENV:mui/WEBTV.1.prefs")
  205.             (dest "ENV:mui")
  206.             (newname "WEBVISION.1.prefs")
  207.             (optional "nofail")
  208.         )
  209.  
  210.         (copyfiles
  211.             (source "ENVARC:mui/WEBTV.1.prefs")
  212.             (dest "ENVARC:mui")
  213.             (newname "WEBVISION.1.prefs")
  214.             (optional "nofail")
  215.         )
  216.     )
  217. )
  218.  
  219. ; Optionally install script to make V work
  220.  
  221. (if
  222.     (askbool
  223.         (prompt "The Voyager webbrowser supports WebTV through sending URLs to it from the context menu of images.  To make this work with WebVision you will need a small script to send the URL on to WebVision.  Would you like to install this script?")
  224.         (help "A script called WebTV is installed in the WebVision directory and the WebTV_LASTUSEDDIR is set to point to the WebVision directory.")
  225.         (default 1)
  226.     )
  227.  
  228.     (
  229.         (copyfiles
  230.             (source "WebTV")
  231.             (dest @default-dest)
  232.         )
  233.  
  234.         (protect
  235.             (tackon @default-dest "WebTV")
  236.             "+s"
  237.         )
  238.  
  239.         (run (cat "Echo " @default-dest " >ENV:WebTV_LASTUSEDDIR NOLINE"))
  240.         (run (cat "Echo " @default-dest " >ENVARC:WebTV_LASTUSEDDIR NOLINE"))
  241.     )
  242. )
  243.  
  244. ; Optionally avoid adult cams in the installation and future auto updates
  245.  
  246. (if
  247.     (= @user-level 0)
  248.     (
  249.         (set #restore-novice-level 1)
  250.         (user 1)                        ; yes, I know this is evil
  251.     )
  252.     (set #restore-novice-level 0)
  253. )
  254.  
  255. (if
  256.     (askbool
  257.         (prompt "WebVision is distributed together with a list of camsites.  Some of these sites are only intended for adult audiences.  If you like, these sites can be left out of the installation.\n\nAdditionally, through the new automatic sitelist update feature (registered users only) you may get new sites that are only suitable for adult audiences. If you like, you can filter out such sites when using the update service.\n\nAvoid adult webcams?")
  258.         (help "The filter setting can be changed later inside the WebVision settings window if you wish.")
  259.         (default 1)
  260.     )
  261.  
  262.     (
  263.         (textfile
  264.             (dest "ENV:WebVision.settings")
  265.             (include "ENV:WebVision.settings")
  266.             (append "NoAdult: Yes\n")
  267.         )
  268.  
  269.         (textfile
  270.             (dest "ENVARC:WebVision.settings")
  271.             (include "ENVARC:WebVision.settings")
  272.             (append "NoAdult: Yes\n")
  273.         )
  274.  
  275.         (set #newsitefile "WebVision.sites")
  276.     )
  277.  
  278.     (set #newsitefile "WebVision_Adult.sites")
  279. )
  280.  
  281. (if
  282.     #restore-novice-level
  283.     (user 0)
  284. )
  285.  
  286. ; Check for prior existance of sitefile
  287.  
  288. (set #oldsitefile (tackon @default-dest "WebVision.sites"))
  289.  
  290. (if
  291.     (exists #oldsitefile)
  292.  
  293.     (set #sitefilechoice
  294.         (askchoice
  295.             (prompt "You have a web camera site configuration file called WebVision.sites already.")
  296.             (help "Overwriting should be safe if you haven't configured any cameras of your own. Appending may create duplicate entries.")
  297.             (choices "pOverwrite old with new file" "Append new file to old one" "Put old sites into \"Old sites\" group" "Skip copying new file")
  298.             (default 2)
  299.         )
  300.     )
  301.  
  302.     (set #sitefilechoice 0)
  303. )
  304.  
  305. ; Overwrite
  306.  
  307. (if 
  308.     (= #sitefilechoice 0)
  309.  
  310.     (copyfiles
  311.         (source #newsitefile)
  312.         (dest @default-dest)
  313.         (newname "WebVision.sites")
  314. ;        (optional force)
  315.     )
  316. )
  317.  
  318. ; Append
  319.  
  320. (if
  321.     (= #sitefilechoice 1)
  322.  
  323.     (textfile
  324.         (include #oldsitefile)
  325.         (include #newsitefile)
  326.         (dest #oldsitefile)
  327.     )
  328. )
  329.  
  330. ; Old sites into group
  331.  
  332. (if
  333.     (= #sitefilechoice 2)
  334.  
  335.     (textfile
  336.         (append "GroupClosed: Old sites\n")
  337.         (include #oldsitefile)
  338.         (append "GroupEnd\n")
  339.         (include #newsitefile)
  340.         (dest #oldsitefile)
  341.     )
  342. )
  343.  
  344. ; Exit
  345.  
  346. (exit #exitmsg)
  347.